Skip to content

VAPI-2823 Implement BRTC Endpoints API with models, controllers, and tests#87

Open
smoghe-bw wants to merge 27 commits intomainfrom
brtc-sdks
Open

VAPI-2823 Implement BRTC Endpoints API with models, controllers, and tests#87
smoghe-bw wants to merge 27 commits intomainfrom
brtc-sdks

Conversation

@smoghe-bw
Copy link

No description provided.

@smoghe-bw smoghe-bw requested review from a team as code owners March 11, 2026 16:43
@smoghe-bw smoghe-bw changed the title Implement BRTC Endpoints API with models, controllers, and tests VAPI-2823 Implement BRTC Endpoints API with models, controllers, and tests Mar 11, 2026
@bwappsec
Copy link

bwappsec commented Mar 11, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

…pointsController and update tests accordingly
… update APIController to use new auth method
…eController; update APIController to use generic auth method
…o implement configureBrtcAuth for BRTC endpoints
…uth to prevent interference with API requests
*/
protected function configureAuth(&$headers, $authType)
{
if (!empty($this->config->getAccessToken()) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is all of this deleted? removing this is essentially removing OAuth support from every endpoint in the SDK, which we definitely do not want to do. All of this needs to be brought back, BRTC should be able to use this in its API calls to also support OAuth. We'll probably need to set up the username/password stuff in the configuration and then add logic to the configure auth function to set those as a fallback

*
* @param array $headers The headers for the request (passed by reference)
*/
protected function configureOAuth2Auth(&$headers)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is unnecessary, the SDK already supports OAuth, so we don't need a BRTC specific oauth function, we need to remove this and use the pre-existing logic that was in the configureAuth function


require_once "Verb.php";

class Connect extends Verb {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is missing the eventCallbackUrl attribute


class Connect extends Verb {
/**
* @var array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @var array
* @var array(Endpoint)

*/
public function toBxml(DOMDocument $doc): DOMElement {
$element = $doc->createElement("Connect");
foreach ($this->endpoints as $endpoint) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id like to add the isset check we do in other verbs here

Comment on lines +271 to +272
$this->assertNotNull($createResp->endpointId);
$this->assertEquals('WEBRTC', $createResp->type);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to be asserting as many fields on the response as possible, feel free to copy what i did for the tn lookup tests

$this->assertEquals('WEBRTC', $createResp->type);

// List endpoints
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above for the try catch and including more assertions

$this->assertContains($createResp->endpointId, $ids, 'Created endpoint should be in list');

// Get endpoint
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

// $voiceClient->updateEndpointBxml($accountId, $createResp->endpointId, $bxml);

// Delete endpoint
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can remove try catch

$this->assertEquals(204, $deleteResp->getStatusCode());
}

public function testCreateEndpointResponseFields() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this and every test after are all unnecessary, we need to be asserting as many fields as possible in our 1 test run, like I mentioned in one of the other SDKs, these tests are strictly to test the SDK functionality, not the API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants